package com.loto.insurance.oem.web.utils;

import java.util.Date;

import com.loto.utils.DateUtils;

public class PolicyUtils {
  public static Date calulatePolicyEnd(Date begin, int period, String unit) {
	Date end = begin;
	switch (unit.toUpperCase()) {
	  case "D":
		end = DateUtils.addDays(begin, period);
		break;
	  case "M":
		end = DateUtils.addMonths(begin, period);
		break;
	  case "Y":
		end = DateUtils.addMonths(begin, 12 * period);
		break;
	}
	return end;
  }
}
